package com.dianrui.moonfire.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.dianrui.moonfire.R;
import com.dianrui.moonfire.interfaces.OnAskDialogCallBack;


public class UserBikeDialogs {

    public static void createAskDialog(Context context, String number, String battery, String journey, final OnAskDialogCallBack onAskDialogCallBack) {
        final Dialog dialog = new Dialog(context, R.style.RcDialog);
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_user_bike, null);
        TextView cancelDialogAsk = view.findViewById(R.id.cancel_dialog_ask);
        TextView yesDialogAsk = view.findViewById(R.id.yes_dialog_ask);
        TextView userBikeNumber = view.findViewById(R.id.number);
        TextView userBikeBattery = view.findViewById(R.id.battery);
        TextView userBikeJourney = view.findViewById(R.id.journey);
        userBikeNumber.setText(number);
        userBikeNumber.setTextColor(context.getResources().getColor(R.color.black));
        userBikeBattery.setText(battery);
        userBikeBattery.setTextColor(context.getResources().getColor(R.color.black));
        userBikeJourney.setText(journey);
        userBikeJourney.setTextColor(context.getResources().getColor(R.color.black));
        cancelDialogAsk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onAskDialogCallBack != null) {
                    onAskDialogCallBack.onCancel(dialog);
                }
            }
        });
        yesDialogAsk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onAskDialogCallBack != null) {
                    onAskDialogCallBack.onokey(dialog);
                }
            }
        });
        dialog.setCanceledOnTouchOutside(false);
        dialog.setContentView(view);
        dialog.show();

    }
}
